package com.cainaer.shop.controller;


import com.cainaer.common.core.utils.StringUtils;
import com.cainaer.common.core.web.controller.BaseController;
import com.cainaer.common.core.web.domain.AjaxResult;
import com.cainaer.shop.domain.ShopInfo;
import com.cainaer.shop.domain.ShopLicense;
import com.cainaer.shop.service.IShopInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商铺信息表 前端控制器
 * </p>
 *
 * @author Tina
 * @since 2020-09-03
 */
@RestController
@RequestMapping("/shopInfo/")
public class ShopInfoController extends BaseController {

    @Autowired
    private IShopInfoService shopInfoService;

    private Logger logger = LoggerFactory.getLogger(ShopInfoController.class);


    /**
     * 编辑商家店铺信息
     *
     * @param shopInfo
     * @return
     */
    @PostMapping("edit")
    public AjaxResult editShopInfoService(@RequestBody ShopInfo shopInfo) {
        logger.info("shopInfo->{}", shopInfo);
        if (StringUtils.isNull(shopInfo.getShopId())) {
            return AjaxResult.error("主键不能为空");
        }
        return toAjax(shopInfoService.editShopInfoByShop(shopInfo));
    }

}
